<?php
namespace app\index\controller;
use extend\Verify;
use lib\Controller;
use lib\Request;

class Common extends Controller {

	protected $data;

	function __construct(Request $request){
		parent::__construct($request);
		$this->data = $request->data;
	}

	/**
     * 验证码
     */
    function verify(){
        $verify = new Verify(['code_length'=>4]);
        $verify->create();
    }

    /**
     * 成功跳转
     * @param $msg
     * @param string $url
     * @return string
     */
   function success($msg, $url = ''){
       $this->set('msg', $msg);
       $this->set('url', $url);
       return $this->fetch('common/success');
   }

    /**
     * 失败跳转
     * @param $msg
     * @param string $url
     * @return string
     */
   function error($msg, $url = ''){
       $this->set('msg', $msg);
       $this->set('url', $url);
       return $this->fetch('common/error');
   }

}